<template>
  <div>
    <div class="dashboard-container">
      
      <div class="big-back-box">
        <div class="top" style="margin-bottom: 20px">资质证照详情</div>
        <div style="width: 600px; margin: 0 auto">
          <el-form ref="form" :model="form" label-width="80px">
            <el-form-item label="名称">
              <el-input v-model="form.name" :disabled="true"></el-input>
            </el-form-item>
        
            <el-form-item label="图片">
              <el-image
                style="width: 300px; height: 300px"
                :src="form.picture"
              ></el-image>
            </el-form-item>
            <!-- 描述 -->
            <el-form-item label="描述">
              <el-input
                type="textarea"
                v-model="form.represent"
                rows="5"
                :disabled="true"
              ></el-input>
            </el-form-item>
            <!-- 价格 -->
            <el-form-item label="价格" style="width: 1000px">
              <span style="margin-left: 10px; font-size: 15px; color: red"
                ><b>{{ this.form.money }}元</b></span
              >
            </el-form-item>
            <!-- 按钮 -->
            <el-form-item>
            
                <el-button type="primary" @click="pay">购买</el-button>
              <router-link to="/license/licenseList">
                <el-button style="margin-left:20px" @click="open">返回</el-button>
              </router-link>
            </el-form-item>
          </el-form>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import {buyQualificationCertificate} from "@/api/qualification_certificate"
export default {
  mounted() {
    this.form = this.$route.query;
  },
  data() {
    return {
      size: "",
      form: {
        name: "",
        type: "",
        represent: "",
        money: null,
        // 图片
        picture: "",
      },
    };
  },
  methods: {
    pay() {
      this.$confirm("确定购买?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
        center: true,
      })
        .then(() => {
          buyQualificationCertificate(this.form).then(res=>{
            if(res.data.result){
             this.$message({
             type: "success",
             message: res.data.message,
          });
            }else{
              this.$message("未登录,请先登录")
            }
          })
        })
        .catch(() => {
          this.$message({
            type: "info",
            message: "已取消购买",
          });
        });
    },
  },
};
</script>

<style lang="scss" scoped>
// 页头LOGO
.top {
  height: 50px;
  font-size: 30px;
  text-align: center;
  line-height: 50px;
}

// 大盒子
.big-back-box {
  width: 1080px;
  margin: 0 auto;
}

// 原框架自带
.dashboard {
  &-container {
    margin-top: 30px;
    // margin-left: 30px;
    // margin-right: 30px;
  }
  &-text {
    font-size: 30px;
    line-height: 46px;
  }
}

// 页脚
.footer {
  height: 300px;
}
.footer-back-box {
  width: 1080px;
  margin-left: 45px;
}
.footer-title {
  height: 30px;
  line-height: 40px;
  padding-left: 10px;
}
.footer-link-card {
  width: 200px;
  background-color: orange;
  margin-left: 10px;
}

// 模板-卡片
.text {
  font-size: 14px;
}
.item {
  padding: 18px 0;
}
.box-card {
  width: 480px;
}
</style>